home *** CD-ROM | disk | FTP | other *** search
/ Animations / Animations CD - Disc 2.iso / mainactor / rexx / relief_adpro.ma < prev    next >
Text File  |  1993-12-04  |  3KB  |  135 lines

  1. /*
  2.  *
  3.  *     Relief V 1.1, 1993 Markus Moenig
  4.  *
  5.  *     Creates a new project with an relief effect from your source project.
  6.  *     Needs AdPro !!
  7.  *     The new project will also be in the format of the selected save module.
  8.  *
  9.  *     The loader/saver of the source project can be either picture
  10.  *     or animation modules.
  11.  *
  12.  *     A new project will be opened for the resulting pictures/animation.
  13.  *
  14.  *     Thanks to Lutz Fauska for the original relief script.
  15.  */
  16.  
  17. OPTIONS RESULTS
  18.  
  19. ADDRESS MAINACTOR 
  20.  
  21. ScreenToFront
  22. PrintAndStoreTXT "Relief V1.1 ..."
  23.  
  24. IF ~SHOW('P','ADPro') THEN DO  /* if not allready running, start adpro */
  25.     ADDRESS MAINACTOR PrintTXT "Invoking AdPro ..."
  26.     ADDRESS COMMAND 'run >NIL: <NIL: adpro:adpro BEHIND MAXMEM=1000000'
  27.     ADDRESS COMMAND Wait 5
  28. END  
  29.  
  30. ADDRESS MAINACTOR
  31.  
  32. GetSPName
  33.  
  34. IF rc = 0 THEN DO                          /* check if project loaded */
  35.  
  36.     PARSE VAR RESULT firstname secondname .  /* store name of the animation */
  37.                                              /* or the names of the picture list */
  38.     ScreenToFront
  39.  
  40.     DeSelectAll
  41.  
  42.     GetSPSaver
  43.     PARSE VAR RESULT savertype savername .   /* store type, name of saver module */
  44.  
  45.                                            /* Store general infos of the project */
  46.     GetSPInfo
  47.     PARSE VAR RESULT width height colors pics caching loop cpf .
  48.  
  49.     IF savertype = "PIC" THEN
  50.         picformat=savername
  51.     ELSE DO
  52.         picformat=IFF
  53.         SetSPSaver PIC picformat
  54.     END
  55.     
  56.     ADDRESS "ADPro"
  57.         LFormat "Universal"
  58.         PSTATUS UNLOCKED
  59.         ORIENTATION PORTRAIT
  60.         SFormat picformat
  61.  
  62.     ADDRESS MAINACTOR
  63.  
  64.     RequestSaveFile "Select Name of Project" /* Ask for Project Name */
  65.  
  66.     IF RC = 10 THEN DO
  67.         PrintTXT "Aborting ..."
  68.         EXIT
  69.     END
  70.  
  71.     newname = RESULT                         /* new name = RESULT */
  72.  
  73.     SelectAll
  74.     
  75.     saveargs=newname
  76.         
  77.     Save saveargs                            /* Save Pictures */
  78.  
  79.     DO i=1 to pics                           /* Scale all pics */
  80.  
  81.         actualpic=newname || "." || Right("00000" || i, 5)
  82.     PrintTxt "ADPro adds relief to Picture" i
  83.  
  84.         ADDRESS "ADPro"    
  85.         Load actualpic
  86.         RENDER_TYPE colors
  87.         OPERATOR "NEGATIVE"
  88.         Load actualpic 1 1 50 -1 -1 -1
  89.         OPERATOR "COLOR_TO_GRAY"
  90.         CONTRAST 50
  91.         OPERATOR "NEGATIVE"
  92.         Execute    
  93.         Save actualpic IMAGE
  94.  
  95.         ADDRESS MAINACTOR
  96.  
  97.     END
  98.  
  99.     IF caching = "CACHING=YES" THEN                 /* Was the old project cached ? */
  100.         
  101.         OpenNewProject "CACHING"               /* If yes new project is also cached */
  102.     
  103.     ELSE 
  104.         
  105.         OpenNewProject                         /* If not new project is not cached */
  106.  
  107.     SetSPLoader PIC picformat                /* Set the new projects loader module */
  108.  
  109.     firstpic=newname || "." || Right("00000" || 1, 5)
  110.     lastpic=newname || "." || Right("00000" || pics, 5)
  111.  
  112.     LoadProject firstpic lastpic             /* Load picture list */
  113.  
  114.     SetSPSaver savertype savername
  115.  
  116.     IF savertype = "ANIM" THEN DO            /* If we wanted a new animation, */
  117.                                              /* we have to build it */
  118.         SelectAll
  119.         saveargs=newname || " " || cpf || " " || loop
  120.         Save saveargs
  121.         UnloadProject
  122.         
  123.         DO i=1 TO pics                         /* delete temporary pics */
  124.             actualpic=newname || "." || Right("00000" || i, 5)
  125.             PrintTxt "Delete " || actualpic
  126.             ADDRESS COMMAND    "delete " || actualpic || "#?"
  127.         END
  128.         
  129.         SetSPLoader savertype savername
  130.         LoadProject newname
  131.     END
  132.     
  133.     PrintAndStoreTXT "READY !!!!"
  134. END
  135.